package com.practice.demo;

import com.practice.demo.Component.UserComponent;
import com.practice.demo.Configuration.UserConfiguration;
import com.practice.demo.Controller.UserController;
import com.practice.demo.Model.UserBean;
import com.practice.demo.Service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@SpringBootApplication
public class SpringIoCApplication {
    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringIoCApplication.class, args);

//        UserController controller=context.getBean(UserController.class);
//        controller.hello();
//        UserConfiguration userConfiguration=context.getBean("userConfiguration",UserConfiguration.class);
//        userConfiguration.hello2();
//        UserService userService=context.getBean(UserService.class);
//        userService.hello();
//        UserService userService1=(UserService) context.getBean("userService");
//        userService1.hello();
        //现在有两个,不知道选哪个了,所以报错
//        UserBean bean=context.getBean(UserBean.class);
//        System.out.println(bean);
        //这个是指定了
//        UserBean bean1=context.getBean("userBean1",UserBean.class);
//        System.out.println(bean1);
       UserController userController=context.getBean(UserController.class);
     //  userController.hello2();



    }
}
